using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using JCTimes.DomainModel.Views;

namespace JCTimes.EFRepository.Mapping
{
    public class V_PDAUsersFunctionsMap : EntityTypeConfiguration<V_PDAUsersFunctions>
    {
        public V_PDAUsersFunctionsMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.UsersID)
                .HasMaxLength(50);

            this.Property(t => t.ParentID)
                .HasMaxLength(50);

            this.Property(t => t.Name)
                .HasMaxLength(50);

            this.Property(t => t.PDAFunctionID)
                .HasMaxLength(50);

            this.Property(t => t.PDAFunctionNo)
                .HasMaxLength(50);

            this.Property(t => t.PDAFunctionName)
                .HasMaxLength(50);

            this.Property(t => t.ParentPDAFunctionNo)
                .HasMaxLength(50);

            this.Property(t => t.ParentPDAFunctionID)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("V_PDAUsersFunctions");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.UsersID).HasColumnName("UsersID");
            this.Property(t => t.ParentID).HasColumnName("ParentID");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.PDAFunctionID).HasColumnName("PDAFunctionID");
            this.Property(t => t.PDAFunctionNo).HasColumnName("PDAFunctionNo");
            this.Property(t => t.PDAFunctionName).HasColumnName("PDAFunctionName");
            this.Property(t => t.ParentPDAFunctionNo).HasColumnName("ParentPDAFunctionNo");
            this.Property(t => t.ParentPDAFunctionID).HasColumnName("ParentPDAFunctionID");
            this.Property(t => t.OrderID).HasColumnName("OrderID");
            this.Property(t => t.CreateDate).HasColumnName("CreateDate");
        }
    }
}
